package com.zero365.autobak.ui;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wb.swt.SWTResourceManager;

public class Login {

	protected Shell shell;
	private Text text;
	private Text text_1;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Login window = new Login();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setImage(SWTResourceManager.getImage("D:\\workspace\\Autobak\\images\\logo.png"));
		shell.setSize(280, 164);
		shell.setText("延长自动备份系统登录");
		
		text = new Text(shell, SWT.BORDER);
		text.setBounds(81, 23, 143, 23);
		
		text_1 = new Text(shell, SWT.BORDER);
		text_1.setBounds(81, 52, 143, 23);
		
		Button button = new Button(shell, SWT.NONE);
		button.setBounds(162, 89, 80, 27);
		button.setText("登  录");
		
		Button quit_but = new Button(shell, SWT.NONE);
		quit_but.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				System.exit(0);
			}
		});
		quit_but.setBounds(26, 89, 80, 27);
		quit_but.setText("退  出");
		
		Label label = new Label(shell, SWT.NONE);
		label.setBounds(26, 29, 45, 17);
		label.setText("用户名:");
		
		Label label_1 = new Label(shell, SWT.NONE);
		label_1.setBounds(26, 58, 45, 17);
		label_1.setText("密   码:");

	}
}
